﻿@model CoreHome.Data.Models.Article

@{
    ViewData["Title"] = "Comment";
}

<div class="container">
    <h1 class="display-4">Comment</h1>
    <br />

    @if (Model.Comments.Count == 0)
    {
        <h5>There is nothing here.</h5>
    }
    else
    {
        @foreach (var comment in Model.Comments)
        {
            <div class="card mb-4">
                <div class="card-header font-weight-bolder">
                    @comment.Time.ToString("yyyy/MM/dd")
                </div>
                <div class="card-body">
                    <div class="markdown">
                        <textarea hidden>@comment.Detail</textarea>
                    </div>
                    
                    @await Component.InvokeAsync("FormLink", new FormLink()
                    {
                        Href = "/Admin/Blog/DelComment/",
                        Text = "Delete",
                        Warning = "Confirm deletion?",
                        ClassName = "btn btn-danger float-right",
                        Paras = new()
                        {
                            { "id", comment.Id.ToString() },
                            { "articleCode", Model.ArticleCode.ToString() }
                        }
                    })
                </div>
            </div>
        }
    }

    <partial name="MarkdownRender" />

</div>

